<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class EducationRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'school_name' => 'required|max:50',
            'major' => 'required|max:50',
            'is_unified' => 'in:0,1',
            'start_time' => 'required|max:20',
            'over_time' => 'required|max:20',
        ];
    }

    public function messages()
    {
        return [
            'school_name.required' => '请输入学校名称',
            'school_name.max' => '学校名称过长',
            'major.required' => '请输入专业名称',
            'major.max' => '专业名称过长',
            'is_unified.in' => '请选择是否统招',
            'start_time.required' => '请选择入学时间',
            'start_time.max' => '入学时间错误',
            'over_time.required' => '请选择离校时间',
            'over_time.max' => '离校时间错误',
        ];
    }
}
